package com.zhou.piledriver.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhou.piledriver.common.PageRequest;
import com.zhou.piledriver.common.R;
import com.zhou.piledriver.common.ResponseResult;
import com.zhou.piledriver.model.entity.PdProject;
import com.zhou.piledriver.model.so.ProjectSO;
import com.zhou.piledriver.model.so.SimpleSo;
import com.zhou.piledriver.service.PdPileService;
import com.zhou.piledriver.service.PdProjectService;
import com.zhou.piledriver.service.PdWarningService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @author ZhouShenBin
 * @date 2024/3/27 10:12
 * @description
 */
@RestController
@RequestMapping("/project")
public class PdProjectController {
    @Resource
    private PdProjectService pdProjectService;
    @PostMapping("/page")
    public ResponseResult page(@RequestBody PageRequest<ProjectSO> so) {
        return R.success(pdProjectService.page(new Page<>(so.getCurrent(), so.getSize()), so.getQuery()));
    }

    @PostMapping("/create")
    public ResponseResult create(@RequestBody PdProject bo) {
        return R.success(pdProjectService.create(bo));
    }

    @GetMapping("/list")
    public ResponseResult list(String tenantId) {
        return R.success(pdProjectService.list(tenantId));
    }
}
